package com.yeyks.common.em.cnbooking;

/**
 * @author fuchangshuai
 * @date 2019/09/23 14:07
 */
public enum CnSortCodeEnum {
    RECOMMEND("RE", "推荐度,传此参数，SortType 失效，默认按推荐度排序"),
    COMMIT("SC", "评价，传此参数，SortType 失效，默认好评优先"),
    PRICE("PR", "价格"),
    STAR("ST", "星级");
    String value;
    String desc;

    CnSortCodeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String value() {
        return this.value;
    }

    public String desc() {
        return this.desc;
    }

    public static String getDesc(String value) {
        for (CnSortCodeEnum cnResponseCodeEnum : values()) {
            if (cnResponseCodeEnum.value().equals(value)) {
                return cnResponseCodeEnum.desc();
            }
        }
        return null;
    }

    public static String getValue(String desc) {
        for (CnSortCodeEnum cnResponseCodeEnum : values()) {
            if (cnResponseCodeEnum.desc().equals(desc)) {
                return cnResponseCodeEnum.value();
            }
        }
        return null;
    }
}
